/*
* yasl-qt (or simply yasl) is a qt-based program for symbian devices
* and intended to manage a shopping list.
* The acronym yasl stands for Yet Another Shopping List.
* 
* Copyright (C) 2011 - Alessandro Orlandi
* 
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/*
* Date: $Date: 2011-08-24 21:04:48 +0000 (Wed, 24 Aug 2011) $
* Revision: $Revision: 21 $
*/

#include "MainWindow.h"
#include <QtGui/QApplication>
#include <QTranslator>
#include <QLocale>
#include <QLibraryInfo>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QTranslator qtTranslator;

    if(!qtTranslator.load("qt_it" /*+ QLocale::system().languageToString()*/,
                      QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
    {
        QString lWarningMsg("Warning: problem loading ");
        lWarningMsg.append( QLibraryInfo::location(QLibraryInfo::TranslationsPath).toStdString().c_str());
        lWarningMsg.append("/qt_it");
        lWarningMsg.append(QLocale::system().name().toStdString().c_str());
        lWarningMsg.append(".qm");
        qWarning(lWarningMsg.toStdString().c_str());
    }
    a.installTranslator(&qtTranslator);


    QTranslator myappTranslator;
    if (! myappTranslator.load("/Data/ShoppingList/yasl_it_IT"))
    {
        QString lWarningMsg("Warning: problem loading /Data/ShoppingList/yasl_");
        lWarningMsg.append( QLocale::system().name().toStdString().c_str());
        lWarningMsg.append(".qm");
        qWarning(lWarningMsg.toStdString().c_str());
    }

    a.installTranslator(&myappTranslator);

     MainWindow w;
#if defined(Q_WS_S60)
    w.showMaximized();
#else
    w.show();
#endif

    return a.exec();
}
